import java.util.ArrayList;
import java.util.Date;

import processing.core.*;
import java.util.Date;
public class Info 
{
	  private PApplet parent = null;
	  float xPos = 0;
	  float yPos = 0;
	  boolean isVisible = true;
	  PFont font;
	  public String info = "";
	  public String peopleInfo = "";
	  public String vehiclesInfo = "";
	  private int scaleFactor = 1;
	  private boolean isOnWall;
	  
	  public Info(PApplet parent, float xPos, float yPos, Case c, int scaleFactor,boolean isOnWall) {
	    this.parent = parent;
	    //this.font = paramFont;
	    this.xPos = xPos;
	    this.yPos = yPos;
	    this.isOnWall = isOnWall;
	    if(c != null){
	    	for (Person p : c.people) {
		    	String pInfo = p.gender + " (" + p.age+") "+p.personType + "\n"+
		    			"Alcohol: " + p.alcohol +"\n"+ "Drugs: " + p.drugs+"\n";
		    	peopleInfo = peopleInfo + pInfo;
		    }
		    for(String vehicle : c.vehicles) {
		    	vehiclesInfo = vehiclesInfo + vehicle+" ";
		    }
		    String adj =  new StringBuffer(c.time).insert( c.time.length()-2, ":").toString();
		    info = c.year + "\n" +
		    	   c.month + ", " + c.day + "\n" +
		    	   adj + "\n" +
		    	   c.county.toLowerCase() + " County \n" +
		    	   "People involved: " + c.people.size() + "\n" + peopleInfo +
		    	   "Vehicles involved: " + c.vehicles.size() + " ("+vehiclesInfo+")\n" +
		    	   "Fatalities: " + c.fatalities + "\n";
	    }	    
	  }
	  
	  void draw() {
	    if(isVisible) {
	        //fill(#FFFFFF);
	        //parent.textFont(font);
	    	parent.fill(255);
	    	if(isOnWall){
	    		parent.textSize(80*scaleFactor);
	    	}
	    	else{
	    		parent.textSize(20*scaleFactor);
	    	}
	    	
	        parent.text(info, xPos, yPos);
	        parent.textSize(8*scaleFactor);
	    }
	  }
	  
	  void setVisible(){
	    isVisible = true;
	  }
	  
	  void setCollapsed() {
	    isVisible = false;
	  }
}
